package com.lanyou.esb.repository;

import java.util.List;

import org.apache.shiro.authz.annotation.Logical;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.Repository;
import org.springframework.data.rest.core.annotation.RestResource;

import com.lanyou.esb.entity.IfAlarmWorkOrderHis;

/**
 * 
 * @author Davey.wu
 */
public interface IfAlarmWorkOrderHisRepository extends
		Repository<IfAlarmWorkOrderHis, String>,
		JpaSpecificationExecutor<IfAlarmWorkOrderHis> {

	long count();

	boolean exists(String id);

	@RestResource(exported = true)
	<S extends IfAlarmWorkOrderHis> S save(S entity); // could expose REST API

	<S extends IfAlarmWorkOrderHis> List<S> save(Iterable<S> entities);

	@RestResource(exported = true)
	@RequiresPermissions(value = { "IfAlarmWorkOrderHisManagement:view",
			"IfAlarmWorkOrderHisManagement:maintain" }, logical = Logical.OR)
	IfAlarmWorkOrderHis findOne(String id); // could expose REST API

	IfAlarmWorkOrderHis getOne(String id);

	// 以下三个接口只能选一个暴露为REST API

	@RestResource(exported = false)
	List<IfAlarmWorkOrderHis> findAll(); // could expose REST API

	@RestResource(exported = false)
	List<IfAlarmWorkOrderHis> findAll(Sort sort); // could expose REST API

	@RestResource(exported = true)
	@RequiresPermissions(value = { "IfAlarmWorkOrderHisManagement:view",
			"IfAlarmWorkOrderHisManagement:maintain" }, logical = Logical.OR)
	Page<IfAlarmWorkOrderHis> findAll(Pageable pageable); // could expose REST
															// API

	List<IfAlarmWorkOrderHis> findAll(Iterable<String> ids);

	// 以下两个接口，要么都暴露为REST API，要么都不暴露
	@RestResource(exported = true)
	// @RequiresPermissions(value={"IfAlarmWorkOrderHisManagement:maintain"})
	void delete(String id); // could expose REST API

	@RestResource(exported = true)
	// @RequiresPermissions(value={"IfAlarmWorkOrderHisManagement:maintain"})
	void delete(IfAlarmWorkOrderHis entity); // could expose REST API

	void delete(Iterable<? extends IfAlarmWorkOrderHis> entities);

	void deleteAll();

	void flush();

	<S extends IfAlarmWorkOrderHis> S saveAndFlush(S entity);

	void deleteInBatch(Iterable<IfAlarmWorkOrderHis> entities);

	void deleteAllInBatch();

}
